/*
 * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.xuexiang.templateproject.fragment.home;

//import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.xuexiang.templateproject.R;
//import com.xuexiang.templateproject.activity.CameraViewActivity;
import com.xuexiang.templateproject.activity.SearchBLEActivity;
import com.xuexiang.templateproject.activity.SearchBTActivity;
import com.xuexiang.templateproject.activity.SoutiActivity;
import com.xuexiang.templateproject.core.BaseFragment;
import com.xuexiang.templateproject.databinding.FragmentHomeBinding;
//import com.xuexiang.templateproject.utils.OssUtils;
import com.xuexiang.templateproject.fragment.camera.CameraFragment;
import com.xuexiang.templateproject.fragment.favorite.FavoriteFragment;
import com.xuexiang.templateproject.fragment.other.SettingsFragment;
import com.xuexiang.xaop.annotation.SingleClick;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xutil.app.ActivityUtils;

/**
 * @author xuexiang
 * @since 2019-10-30 00:19
 */
@Page(name = "HomeFragment",anim = CoreAnim.none)
public class HomeFragment extends BaseFragment<FragmentHomeBinding> implements View.OnClickListener {

    @NonNull
    @Override
    protected FragmentHomeBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
        return FragmentHomeBinding.inflate(inflater, container, attachToRoot);
    }

    /**
     * @return 返回为 null意为不需要导航栏
     */
    @Override
    protected TitleBar initTitle() {
        return null;
    }

    /**
     * 初始化控件
     */
    @Override
    protected void initViews() {
        binding.iconSettings.setOnClickListener(this);
        binding.iconSaoti.setOnClickListener(this);
        binding.iconShoucang.setOnClickListener(this);
    }
    @SingleClick
    @Override
    public void onClick(View view) {
        switch(view.getId()) {
            case R.id.icon_saoti:
//                ActivityUtils.startActivity(SoutiActivity.class);
                openPage(CameraFragment.class);
                break;
            case R.id.icon_shoucang:
                openPage(FavoriteFragment.class);
                break;
            case R.id.icon_settings:
//                ActivityUtils.startActivity(SearchBLEActivity.class);
                openPage(SettingsFragment.class);
                break;
            default:
                break;
        }
    }

}
